import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.net.ssl.SSLSocketFactory;


public class T_Mobile {

	public static void main(String[] args) throws Exception {
	
		T_Mobile t = new T_Mobile();
		//t.listAllJarFiles("D:\\workspace\\12_4_10\\code\\lib");
		
//	    SSLSocketFactory sslsf = (SSLSocketFactory) SSLSocketFactory.getDefault();
//	    String[] ciphers = sslsf.getDefaultCipherSuites();
//	    Arrays.sort(ciphers);
//	    for (String cipher : ciphers) {
//	      System.out.println(cipher);
//	    }
		
		List<? extends Number> list = new ArrayList();
		//list.add(new Integer(1));
		
		
		long start = System.currentTimeMillis();  
		RandomAccessFile r = new RandomAccessFile(new File("d:\\test.dat"), "rw");
		r.setLength(1024*1024*1024);
		long end = System.currentTimeMillis();  
        System.out.println(end-start);  
		

	}
	
	public void listAllJarFiles(String dirPath) throws Exception {
		
		File file = new File(dirPath);
		if(file.isDirectory()) {
			
			File[] files = file.listFiles();
			for(int i=0; i<files.length; i++) {
				listAllJarFiles(files[i].getAbsolutePath());
			}
		} else {
			
			if(file.getName().endsWith("jar")) {
				System.out.println(file.getAbsolutePath());
				this.copyFile_old(file.getAbsolutePath(), "D:\\workspace\\12_4_10\\libs\\"+ file.getName());
			}
		}
	}
			
	public void copyFile_old(String sourceFile, String destinationFile) throws Exception {
		FileInputStream fis = new FileInputStream(sourceFile);
		FileOutputStream fos = new FileOutputStream(destinationFile);
		byte[] buff = new byte[1024];
		int readed = -1;
		while ((readed = fis.read(buff)) > 0)
			fos.write(buff, 0, readed);
		fis.close();
		fos.close();
	}
}
